/*
Copyright [2012] [Maria Eugenia Malagamba]
Copyright [2012] [Leandro Pellegrino]
Copyright [2012] [Julia Gambuzzi]
Copyright [2012] [Ignacio Capodanno]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

#include "Bomba.h"
using namespace Entidades;

Bomba::Bomba(int duracion,double direccion, int velocidad, double posicionX, double posicionY, string pathDeLaImagen, 
			 int anchoDeLaImagen, int altoDeLaImagen, double rotacionDeLaImagen, int poderDeDestruccion, int radioDeExplosion)
			 :Arma(duracion,direccion, velocidad, posicionX, posicionY,pathDeLaImagen, anchoDeLaImagen, altoDeLaImagen, rotacionDeLaImagen,5){

				 this->poderDeDestruccion = poderDeDestruccion;
				 this->radioMaximo = radioDeExplosion;
				 this->radioExplosion=21;

}

char Bomba::getTipo(){
	return 'B';
}

int Bomba::colisionar(int danio){

	this->radioExplosion = this->radioMaximo;
	this->poderDeDestruccion = 30;
    this->estado = 'E';

	return this->poderDeDestruccion;
}

void Bomba::setEstado(char estado){

	this->estado = estado;
	if (estado == 'E' && this->radioExplosion != this->radioMaximo){
		this->radioExplosion = this->radioMaximo;
	}
}


bool Bomba::hayColisionDeImagenCon(Colisionable * otroColisionable){

	return this->hayColisionDeImagenConCirculo(otroColisionable,this->radioExplosion);	
}

bool Bomba::hayColisionDeContornoCon(Colisionable * otroColisionable){

	return this->hayColisionDeContornoConCirculo(otroColisionable,this->radioExplosion);
}

//void Bomba::pintarImagen(SDL_Surface* superficiePantalla)
//{
//	SDL_Surface* imagenRotada = this->rotarImagen(superficiePantalla);
//
//	SDL_FreeSurface(this->ultimaRotacion);
//	this->setUltimaRotacion(imagenRotada);
//
//		int posX = this->getPosicionX();
//		int posY = this->getPosicionY();
//
//		if (this->radioExplosion != ( this->getAltoDeLaImagen() /2 )){
//			posX = this->getPosicionX() - this->radioExplosion + (this->getAltoDeLaImagen() /2 );
//			posY = this->getPosicionY() - this->radioExplosion + (this->getAltoDeLaImagen() /2 );
//		}
//
//		rectangleRGBA(superficiePantalla, posX , posY,
//			posX + this->radioExplosion*2, posY + this->radioExplosion*2,
//			0, 255, 0, 255);
//		circleRGBA(superficiePantalla,posX + this->radioExplosion,posY +this->radioExplosion,
//			radioExplosion,0,255,0,255);
//	
//}



Bomba::~Bomba(void)
{

}
